Convert GailArrow to GtkArrowAccessible
authorMatthias Clasen <mclasen@redhat.com>
Mon, 27 Jun 2011 01:28:37 +0000 (21:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 5 Jul 2011 20:08:10 +0000 (16:08 -0400)
gtk/a11y/Makefile.am
gtk/a11y/gail.c
gtk/a11y/gailarrow.c [deleted file]
gtk/a11y/gailarrow.h [deleted file]
gtk/a11y/gtkarrowaccessible.c [new file with mode: 0644]
gtk/a11y/gtkarrowaccessible.h [new file with mode: 0644]
gtk/gtkarrow.c

index ca2181d15c24dd98c342248bea8d0ee5e990e2f2..8674a264fdc0defebeb489bed48cf5da0b5134b9 100644 (file)
@@ -6,7 +6,7 @@ gail_c_sources =                        \
        gail-private-macros.h           \
        gail.c                          \
        gailadjustment.c                \
-       gailarrow.c                     \
+       gtkarrowaccessible.c            \
        gailbooleancell.c               \
        gailbox.c                       \
        gailbutton.c                    \
@@ -60,7 +60,7 @@ libgailincludedir=$(includedir)/gail-3.0/gail
 
 gail_private_h_sources =               \
        gailadjustment.h                \
-       gailarrow.h                     \
+       gtkarrowaccessible.h            \
        gailbooleancell.h               \
        gailbox.h                       \
        gailbutton.h                    \
index b9e25f6ce94cde160f78cd1f766cc3522c0499de..31fd181f5122b625a73aa32cc2ba7514f207efe8 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <gtk/gtkx.h>
 #include "gailadjustment.h"
-#include "gailarrow.h"
 #include "gailbooleancell.h"
 #include "gailbox.h"
 #include "gailbutton.h"
@@ -128,7 +127,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PROGRESS_BAR, GailProgressBar, gail_progress_b
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TREE_VIEW, GailTreeView, gail_tree_view, GTK_TYPE_TREE_VIEW)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_FRAME, GailFrame, gail_frame, GTK_TYPE_FRAME)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RADIO_BUTTON, GailRadioButton, gail_radio_button, GTK_TYPE_RADIO_BUTTON)
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_ARROW, GailArrow, gail_arrow, GTK_TYPE_ARROW)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SEPARATOR, GailSeparator, gail_separator, GTK_TYPE_SEPARATOR)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_BOX, GailBox, gail_box, GTK_TYPE_BOX)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCROLLED_WINDOW, GailScrolledWindow, gail_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
@@ -905,7 +903,6 @@ gail_accessibility_module_init (void)
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER, gail_renderer_cell);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_BUTTON, gail_radio_button);
-  GAIL_WIDGET_SET_FACTORY (GTK_TYPE_ARROW, gail_arrow);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SEPARATOR, gail_separator);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_BOX, gail_box);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCROLLED_WINDOW, gail_scrolled_window);
diff --git a/gtk/a11y/gailarrow.c b/gtk/a11y/gailarrow.c
deleted file mode 100644 (file)
index 9253d84..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/* GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2001 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include "gailarrow.h"
-
-static void gail_arrow_class_init      (GailArrowClass *klass);
-static void gail_arrow_init            (GailArrow      *arrow);
-static void gail_arrow_initialize       (AtkObject      *accessible,
-                                         gpointer        data);
-
-/* AtkImage */
-static void  atk_image_interface_init   (AtkImageIface  *iface);
-static const gchar* gail_arrow_get_image_description
-                                        (AtkImage       *obj);
-static gboolean gail_arrow_set_image_description 
-                                        (AtkImage       *obj,
-                                        const gchar    *description);
-static void  gail_arrow_finalize       (GObject         *object);
-
-G_DEFINE_TYPE_WITH_CODE (GailArrow, gail_arrow, GAIL_TYPE_WIDGET,
-                         G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
-
-static void     
-gail_arrow_class_init          (GailArrowClass *klass)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
-
-  atk_object_class->initialize = gail_arrow_initialize;
-
-  gobject_class->finalize = gail_arrow_finalize;
-}
-
-static void
-gail_arrow_init (GailArrow *arrow)
-{
-  arrow->image_description = NULL;
-}
-
-static void
-gail_arrow_initialize (AtkObject *accessible,
-                       gpointer data)
-{
-  ATK_OBJECT_CLASS (gail_arrow_parent_class)->initialize (accessible, data);
-
-  accessible->role = ATK_ROLE_ICON;
-}
-
-static void
-atk_image_interface_init (AtkImageIface *iface)
-{
-  iface->get_image_description = gail_arrow_get_image_description;
-  iface->set_image_description = gail_arrow_set_image_description;
-}
-
-static const gchar*
-gail_arrow_get_image_description (AtkImage       *obj)
-{
-  GailArrow* arrow;
-
-  g_return_val_if_fail(GAIL_IS_ARROW(obj), NULL);
-
-  arrow = GAIL_ARROW (obj);
-
-  return arrow->image_description;
-}
-
-static gboolean 
-gail_arrow_set_image_description (AtkImage       *obj,
-                                  const gchar    *description)
-{
-  GailArrow* arrow;
-
-  g_return_val_if_fail(GAIL_IS_ARROW(obj), FALSE);
-
-  arrow = GAIL_ARROW (obj);
-  g_free (arrow->image_description);
-
-  arrow->image_description = g_strdup (description);
-
-  return TRUE;
-
-}
-
-/*
- * static void  
- * gail_arrow_get_image_size (AtkImage       *obj,
- *                          gint           *height,
- *                          gint           *width)
- *
- * We dont implement this function for GailArrow as gtk hardcodes the size 
- * of the arrow to be 7x5 and it is not possible to query this.
- */
-
-static void
-gail_arrow_finalize (GObject      *object)
-{
-  GailArrow *arrow = GAIL_ARROW (object);
-
-  g_free (arrow->image_description);
-  G_OBJECT_CLASS (gail_arrow_parent_class)->finalize (object);
-}
diff --git a/gtk/a11y/gailarrow.h b/gtk/a11y/gailarrow.h
deleted file mode 100644 (file)
index e8a8772..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2001 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GAIL_ARROW_H__
-#define __GAIL_ARROW_H__
-
-#include "gailwidget.h"
-
-G_BEGIN_DECLS
-
-#define GAIL_TYPE_ARROW                      (gail_arrow_get_type ())
-#define GAIL_ARROW(obj)                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_ARROW, GailArrow))
-#define GAIL_ARROW_CLASS(klass)              (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_ARROW, GailArrowClass))
-#define GAIL_IS_ARROW(obj)                   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_ARROW))
-#define GAIL_IS_ARROW_CLASS(klass)           (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_ARROW))
-#define GAIL_ARROW_GET_CLASS(obj)            (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_ARROW, GailArrowClass))
-
-typedef struct _GailArrow              GailArrow;
-typedef struct _GailArrowClass         GailArrowClass;
-
-struct _GailArrow
-{
-  GailWidget parent;
-
-  gchar*     image_description;
-};
-
-GType gail_arrow_get_type (void);
-
-struct _GailArrowClass
-{
-  GailWidgetClass parent_class;
-};
-
-G_END_DECLS
-
-#endif /* __GAIL_ARROW_H__ */
diff --git a/gtk/a11y/gtkarrowaccessible.c b/gtk/a11y/gtkarrowaccessible.c
new file mode 100644 (file)
index 0000000..78f157f
--- /dev/null
@@ -0,0 +1,93 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include "gtkarrowaccessible.h"
+
+
+static void atk_image_interface_init (AtkImageIface  *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtkArrowAccessible, gtk_arrow_accessible, GAIL_TYPE_WIDGET,
+                         G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
+
+static void
+gtk_arrow_accessible_initialize (AtkObject *accessible,
+                                 gpointer   data)
+{
+  ATK_OBJECT_CLASS (gtk_arrow_accessible_parent_class)->initialize (accessible, data);
+
+  accessible->role = ATK_ROLE_ICON;
+}
+
+static void
+gtk_arrow_accessible_finalize (GObject *object)
+{
+  GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (object);
+
+  g_free (arrow->image_description);
+
+  G_OBJECT_CLASS (gtk_arrow_accessible_parent_class)->finalize (object);
+}
+
+static void
+gtk_arrow_accessible_class_init (GtkArrowAccessibleClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
+
+  atk_object_class->initialize = gtk_arrow_accessible_initialize;
+
+  gobject_class->finalize = gtk_arrow_accessible_finalize;
+}
+
+static void
+gtk_arrow_accessible_init (GtkArrowAccessible *arrow)
+{
+  arrow->image_description = NULL;
+}
+
+static const gchar *
+gtk_arrow_accessible_get_image_description (AtkImage *obj)
+{
+  GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj);
+
+  return arrow->image_description;
+}
+
+static gboolean
+gtk_arrow_accessible_set_image_description (AtkImage    *obj,
+                                            const gchar *description)
+{
+  GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj);
+
+  g_free (arrow->image_description);
+  arrow->image_description = g_strdup (description);
+
+  return TRUE;
+
+}
+
+static void
+atk_image_interface_init (AtkImageIface *iface)
+{
+  iface->get_image_description = gtk_arrow_accessible_get_image_description;
+  iface->set_image_description = gtk_arrow_accessible_set_image_description;
+}
diff --git a/gtk/a11y/gtkarrowaccessible.h b/gtk/a11y/gtkarrowaccessible.h
new file mode 100644 (file)
index 0000000..ee68c0b
--- /dev/null
@@ -0,0 +1,53 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_ARROW_ACCESSIBLE_H__
+#define __GTK_ARROW_ACCESSIBLE_H__
+
+#include "gailwidget.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_ARROW_ACCESSIBLE                      (gtk_arrow_accessible_get_type ())
+#define GTK_ARROW_ACCESSIBLE(obj)                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ARROW_ACCESSIBLE, GtkArrowAccessible))
+#define GTK_ARROW_ACCESSIBLE_CLASS(klass)              (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ARROW_ACCESSIBLE, GtkArrowAccessibleClass))
+#define GTK_IS_ARROW_ACCESSIBLE(obj)                   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ARROW_ACCESSIBLE))
+#define GTK_IS_ARROW_ACCESSIBLE_CLASS(klass)           (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ARROW_ACCESSIBLE))
+#define GTK_ARROW_ACCESSIBLE_GET_CLASS(obj)            (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ARROW_ACCESSIBLE, GtkArrowAccessibleClass))
+
+typedef struct _GtkArrowAccessible      GtkArrowAccessible;
+typedef struct _GtkArrowAccessibleClass GtkArrowAccessibleClass;
+
+struct _GtkArrowAccessible
+{
+  GailWidget parent;
+
+  gchar *image_description;
+};
+
+struct _GtkArrowAccessibleClass
+{
+  GailWidgetClass parent_class;
+};
+
+GType gtk_arrow_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_ARROW_ACCESSIBLE_H__ */
index b8744e70ba722ffa735065f4d47bce00c22a21bf..0df37bebc7263429c2150501677fe475e3396bce 100644 (file)
@@ -52,6 +52,8 @@
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
+#include "a11y/gtkarrowaccessible.h"
+
 #define MIN_ARROW_SIZE  15
 
 struct _GtkArrowPrivate
@@ -130,6 +132,8 @@ gtk_arrow_class_init (GtkArrowClass *class)
                                                                GTK_PARAM_READABLE));
 
   g_type_class_add_private (class, sizeof (GtkArrowPrivate));
+
+  gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ARROW_ACCESSIBLE);
 }
 
 static void